import http from '@/utils/http'

/**
 * @description 获取订单详情
 * @returns Promise
 */
export const reqOrderInfo = () => {
    return http.get("/order/trade")
}

/**
 * @description 订单详情中收获地址
 * @returns Promise
 */
export const reqOrderAddress = () => {
    return http.get("/userAddress/getOrderAddress")
}

/**
 * @description 立即购买商品
 * @param {*} param { goods: 商品id, blessing: 祝福语} 
 * @returns Promise
 */
export const reqBuyNowGoods = ({ goodsId, ...data}) => {
    return http.get(`/order/buy/${goodsId}`, data)
}

/**
 * @description 提交订单
 * @returns Promise
 */
export const reqSubmitOrder = (data) => {
    return http.post("/order/submitOrder",data)
}

/**
 * @description 获取微信支付预支付信息
 * @param {*} orderNo: 订单id
 * @returns Promise
 */
export const reqPrePayInfo = (orderNo) => {
    return http.get(`/webChat/createJsapi/${orderNo}`)
}

/**
 * @description 微信支付状态查询
 * @param {*} orderNo: 订单id
 * @returns Promise
 */
export const reqPayStatus = (orderNo) => {
    return http.get(`/webChat/queryPayStatus/${orderNo}`)
}

/**
 * @description 获取订单列表
 * @param {*} page 
 * @param {*} limit 
 * @returns Promise
 */
export const reqGetOrderList = (page, limit) => {
    return http.get(`/order/order/${page}/${limit}`)
}
